package com.zzs.covid19_view.common.entity;

import lombok.Data;
import lombok.ToString;

import java.util.List;
import java.util.Objects;

/**
 * 文件名: AreaStat
 * 创建者: zzs
 * 创建时间: 2021/8/12 11:48
 * 描述: 地区
 */
@Data
@ToString
public class AreaStat {

    /**
     * provinceName : 湖北省
     * provinceShortName : 湖北
     * confirmedCount : 549
     * suspectedCount : 0
     * curedCount : 31
     * deadCount : 24
     * comment :
     * cities : [{"cityName":"武汉","confirmedCount":495,"suspectedCount":0,"curedCount":31,"deadCount":23},
     *           {"cityName":"孝感","confirmedCount":22,"suspectedCount":0,"curedCount":0,"deadCount":0},
     *           {"cityName":"黄冈","confirmedCount":12,"suspectedCount":0,"curedCount":0,"deadCount":0},
     *           {"cityName":"荆州","confirmedCount":8,"suspectedCount":0,"curedCount":0,"deadCount":0},
     *           {"cityName":"荆门","confirmedCount":8,"suspectedCount":0,"curedCount":0,"deadCount":0},
     *           {"cityName":"仙桃","confirmedCount":2,"suspectedCount":0,"curedCount":0,"deadCount":0},
     *           {"cityName":"宜昌","confirmedCount":1,"suspectedCount":0,"curedCount":0,"deadCount":1},
     *           {"cityName":"十堰","confirmedCount":1,"suspectedCount":0,"curedCount":0,"deadCount":0}]
     */

    private String id;
    /**
     * 省份名称
     */
    private String provinceName;
    /**
     * 省份名称简称
     */
    private String provinceShortName;
    /**
     * 累计确诊
     */
    private int confirmedCount;
    /**
     * 疑似数量(又称境外输入)
     */
    private int suspectedCount;
    /**
     * 累计治愈
     */
    private int curedCount;
    /**
     * 累计死亡
     */
    private int deadCount;
    /**
     * 评论
     */
    private String comment;
    /**
     * 城市列表
     */
    private List<CitiesBean> cities;
    /**
     * 修改时间
     */
    private long modifyTime;

    /**
     * 比较关键数字即可
     * @param o
     * @return
     */
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        AreaStat areaStat = (AreaStat) o;
        return confirmedCount == areaStat.confirmedCount &&
                suspectedCount == areaStat.suspectedCount &&
                curedCount == areaStat.curedCount &&
                deadCount == areaStat.deadCount;
    }

    @Override
    public int hashCode() {
        return Objects.hash(provinceName, provinceShortName, confirmedCount, suspectedCount, curedCount, deadCount, comment, cities, modifyTime);
    }

    @Data
    @ToString
    public static class CitiesBean {
        /**
         * cityName : 武汉
         * confirmedCount : 495
         * suspectedCount : 0
         * curedCount : 31
         * deadCount : 23
         */

        private String id;
        /**
         * 城市名称
         */
        private String cityName;
        /**
         * 累计确诊
         */
        private int confirmedCount;
        /**
         * 疑似数量(又称境外输入)
         */
        private int suspectedCount;
        /**
         * 累计治愈
         */
        private int curedCount;
        /**
         * 累计死亡
         */
        private int deadCount;
        /**
         * 省份名称
         */
        private String provinceName;
        /**
         * 修改时间
         */
        private long modifyTime;

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            CitiesBean that = (CitiesBean) o;
            return confirmedCount == that.confirmedCount &&
                    suspectedCount == that.suspectedCount &&
                    curedCount == that.curedCount &&
                    deadCount == that.deadCount;
        }

        @Override
        public int hashCode() {
            return Objects.hash(cityName, confirmedCount, suspectedCount, curedCount, deadCount, provinceName, modifyTime);
        }
    }
}
